package com.workmanager.service;

import com.workmanager.bean.*;
import com.workmanager.mapper.StudentWorkMapper;
import com.workmanager.mapper.TeacherWorkMapper;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.List;

/**
 * Created by YIJIE on 2016/9/2.
 */
@Service("studentWorkService")
public class StudentWorkService {
    private StudentWorkMapper studentWorkMapper;
    /**
     * 获取自己所有的作业，数据在checkHistorywork.jsp页面显示
     */
    public List<WorkBean> getAllworkById(int student_id){
        List<WorkBean> list = studentWorkMapper.getAllworkById(student_id);
        return list;
    }
    public String getTeacherid(int student_id){
        return studentWorkMapper.getTeacherid(student_id);
    }
    public String getJobTaskNum(int class_id){
        return studentWorkMapper.getJobTaskNum(class_id);
    }
    public String getMyTaskNum(int student_id){
        return studentWorkMapper.getMyTaskNum(student_id);
    }
    public boolean insertfeed(FeedbackBean feedbackBean){
        return studentWorkMapper.insert(feedbackBean);
    }

    /**
     * 根据work_id获取work相关信息
     */
    public WorkBean getWorkById(int work_id){
        WorkBean workBean = studentWorkMapper.getWorkById(work_id);
        return workBean;
    }
    /**
     * 获取老师的评价，数据在feedback.jsp页面显示
     */
    public List<EvaluateBean> getEvaluateById(int work_id){
        List<EvaluateBean> evaluateBean = studentWorkMapper.getEvaluateById(work_id);
        return evaluateBean;
    }

    /**
     *获取学生的反馈，数据在feedback.jsp页面显示
     */
    public List<FeedbackBean> getFeedbackById(int work_id){
        return studentWorkMapper.getFeedbackById(work_id);
    }

    public boolean submitComments(LeaveMessageBean leaveMessageBean) {
        return studentWorkMapper.insertComments(leaveMessageBean);
    }
    /**
     *根据学生id找老师
     */
    public TeacherBean getTeacherById(int student_id){
        TeacherBean teacherBean = studentWorkMapper.getTeacherById(student_id);
        return teacherBean;
    }
    public String getClassById(int class_id){
        return studentWorkMapper.getClassById(class_id);

    }
    /**
     * 根据学生id获取留言的全部信息
     * @param studentid
     * @return
     */
    public List<LeaveMessageBean> getmessagebystudentid(int studentid){
        return studentWorkMapper.getmessagebystudentid(studentid);
    }

    public StudentWorkMapper getStudentWorkMapper() {
        return studentWorkMapper;
    }

    public void setStudentWorkMapper(StudentWorkMapper studentWorkMapper) {
        this.studentWorkMapper = studentWorkMapper;
    }

}
